package com.etone.smartAudit.task;

import com.etone.smartAudit.service.BuildOnService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Log4j2
public class BuildOnTask {
    @Value("${audit.task.enable:false}")
    private Boolean enableTask;

    @Autowired
    private BuildOnService buildOnService;

    /**
     * 每个小时的15分开始执行一次
     */
    @Scheduled(cron = "0 0/5 * * * ?")
    public void sygnFaiLog() {
        if (enableTask) {
            log.info("===========================开始获取建审数据===========================");
            buildOnService.getBuildOn();
            log.info("===========================结束获取建审数据===========================");
        }

    }
}
